//
//  StatusTableViewBottomView.swift
//  SinaWeibo
//
//  Created by 林柱强 on 16/2/3.
//  Copyright © 2016年 林柱强. All rights reserved.
//

import UIKit
import SnapKit

class StatusTableViewBottomView: UIView {

    @objc private func retweetedBtnDidClick() {
        let temp = TempViewController()
        retweetButton.NavController()?.pushViewController(temp, animated: true)
    }
    
    //重写父类方法
    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = UIColor(white: 0.98, alpha: 1.0)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //设置UI
    private func setupUI() {
        addSubview(retweetButton)
        addSubview(composeButton)
        addSubview(unlikeButton)
        
        //设置约束
        xmg_HorizontalTile([retweetButton, unlikeButton, composeButton], insets: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0))
        
        //添加点击事件
        retweetButton.addTarget(self, action: "retweetedBtnDidClick", forControlEvents: .TouchUpInside)
    }
    
    //创建分割线
    private func sepView() -> UIView {
        let sepView = UIView()
        sepView.backgroundColor = UIColor.darkGrayColor()
        return sepView
    }
    
    //懒加载控件
    private lazy var retweetButton: UIButton = UIButton(title: "转发", backImage: nil, color: UIColor.darkGrayColor(), image: "timeline_icon_retweet", size: 10)
    private lazy var composeButton: UIButton = UIButton(title: "评论", backImage: nil, color: UIColor.darkGrayColor(), image: "timeline_icon_comment", size: 10)
    private lazy var unlikeButton: UIButton = UIButton(title: "赞", backImage: nil, color: UIColor.darkGrayColor(), image: "timeline_icon_unlike", size: 10)
}
